using System;
using System.Xml;
using System.Configuration;

namespace ObjectContainer
{
    /// <summary>
    /// Ensures a unique instance for the entire application domian.
    /// </summary>
    public class SingletonContainer
    {
        private static Container _instance;

        static SingletonContainer()
        {
            string configString = null;
            string configFileName = ConfigurationSettings.AppSettings["objectcontianerconfig"];
            if(!String.IsNullOrEmpty(configFileName))
            {
                configString =  System.IO.File.ReadAllText(configFileName);
            }
            _instance = new Container(configString);
        }

        public static Container Instance
        { 
            get { return _instance; }
        }
    }
}
